<?php
    if(!isset($showitem) && isset($_GET['showitem']))
        $showitem = $_GET['showitem'];
    
    if(!isset($lastshowitem) && isset($_GET['lastshowitem']))
        $lastshowitem = $_GET['lastshowitem'];
    
    if($showitem == 'register') $pagecontent = 'register';
    elseif($showitem == 'forgotpassword') $pagecontent = 'forgotpassword';
    elseif($showitem == 'aboutushistory') $pagecontent = 'aboutushistory';
    elseif($showitem == 'impressum') $pagecontent = 'impressum';
    elseif($showitem == 'terms') $pagecontent = 'terms';
    elseif($showitem == 'datasecurity') $pagecontent = 'datasecurity';
    elseif($showitem == 'sitemap') $pagecontent = 'sitemap';
    elseif($showitem == 'feedback') $pagecontent = 'feedback';
    elseif($showitem == 'twitter') $pagecontent = 'twitter';
    else $pagecontent = 'blog';
    
    if($pagecontent == 'register')
        $intromessage = $registrationintro;
    elseif($pagecontent == 'forgotpassword')
        $intromessage = $forgotpasswordintro;
    elseif(isset($_SESSION['id']))
        $intromessage = $hello.' '.$user->name;
    else $showlogin = true;
    
    $loginurl = 'login.php?retpage='.$_SERVER['PHP_SELF'].'&showitem='.$showitem;
    $registerurl = 'register.php?retpage='.$_SERVER['PHP_SELF'].'&showitem='.$lastshowitem;
    $resetpasswordurl = 'passwordreset.php?retpage='.$_SERVER['PHP_SELF'].'&showitem='.$lastshowitem;
?>
<?php // Login box / welcome message area ?>
<?php // ******************************** ?>
<?php if($showlogin == true): ?>
    <div class="loginbox <?php echo 'loginbox'.$lang ?>">
        <form class="loginform" action="<?php echo $loginurl ?>" method="post" accept-charset="UTF-8">
            <fieldset>
                <legend><?php echo $login ?></legend>
                <label for="username"><?php echo $username ?>*</label>
                <input type="text" class="usernamebox" name="username" />
                <label for="password"><?php echo $password ?>*</label>
                <input type="password" class="passwordbox" name="password" />
                <input type="submit" name="loginsubmit" value="<?php echo $submit ?>" />
                <div class="passwordreset">
                    <?php if(isset($_SESSION['usernotfound'])) echo $usernotfound.' ' ?>
                    <a href="?showitem=forgotpassword"><?php echo $forgotpassword ?></a>
                </div>
            </fieldset>
        </form>
    </div>
<?php else: ?>
    <div class="introbox">
        <span class="greeting"><?php echo $intromessage; ?></span>
    </div>
<?php endif; ?>
<?php // Page content area ?>
<?php // ***************** ?>
<?php if($pagecontent == 'register'): ?>
    <div class="registrationbox">
        <form class="registrationform" action="<?php echo $registerurl; ?>" method="post" accept-charset="UTF-8">
            <fieldset>
                <legend><?php echo $register; ?></legend>
                <table cellpadding="0" cellspacing="0" border="0">
                    <tr>
                        <td class="heading"><?php echo $profile; ?></td>
                        <td class="info"></td>
                        <td class="heading"><?php echo $partnerprofile; ?></td>
                        <td class="info"></td>
                    </tr>
                    <tr>
                        <td><?php echo $name; ?></td>
                        <td><input type="text" name="name" value="" tabindex="1" /></td>
                        <td><?php echo $name; ?></td>
                        <td><input type="text" name="partnername" value="" tabindex="4" /></td>
                    </tr>
                    <tr>
                        <td><?php echo $surname; ?></td>
                        <td><input type="text" name="surname" value="" tabindex="2" /></td>
                        <td><?php echo $surname; ?></td>
                        <td><input type="text" name="partnersurname" value="" tabindex="5" /></td>
                    </tr>
                    <tr>
                        <td><?php echo $email; ?></td>
                        <td><input type="text" name="email" value="" tabindex="3" /></td>
                        <td><?php echo $email; ?></td>
                        <td><input type="text" name="partneremail" value="" tabindex="6" /></td>
                    </tr>
                    <tr>
                        <td><input type="submit" name="submit" value="<?php echo $register; ?>" tabindex="7" /></td>
                        <td></td>
                        <td></td>
                        <td></td>
                    </tr>
                </table>
            </fieldset>
        </form>
    </div>
<?php elseif($pagecontent == 'forgotpassword'): ?>
    <div class="forgotpasswordbox">
        <form class="registrationform" action="<?php echo $forgotpasswordurl; ?>" method="post" accept-charset="UTF-8">
            <fieldset>
                <legend><?php echo $passwordreset; ?></legend>
                <table cellpadding="0" cellspacing="0" border="0">
                    <tr>
                        <td class="heading"><?php echo $email; ?></td>
                        <td class="info"><input type="text" class="emailbox" name="email" value="" tabindex="1" /></td>
                    </tr>
                    <tr>
                        <td><input type="submit" name="forgotpasswordsubmit" value="<?php echo $reset; ?>" tabindex="2" /></td>
                        <td></td>
                    </tr>
                </table>
            </fieldset>
        </form>
    </div>
<?php else: ?>
    <div class="contentbox">
        <div id="scrollbar1">
        <div class="scrollbar"><div class="track"><div class="thumb"><div class="end"></div></div></div></div>
        <div class="viewport">
            <div class="overview">
                <?php if($pagecontent == 'blog'): ?>
                    <div class="fbfeed">
                        <?php include 'phpincludes/fbfeed.php' ?>
                    </div>
                <?php elseif($pagecontent == 'twitter'): ?>
                    <div class="fbfeed">
                        <?php include 'phpincludes/twitterfeed.php' ?>
                    </div>
                <?php else: ?>
                    <?php echo $pagecontent ?>
                <?php endif; ?>
            </div>
        </div>
    </div>
<?php endif; ?>
